package com.leigq.www.producer.sender;

import com.leigq.www.common.enums.KafKaMsgBizType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * The type Kaf ka sender factory.
 * @author leiguoqing
 */
@SuppressWarnings(value = "rawtypes")
@Component
public class KafKaSenderFactory {

    /**
     * The Kaf ka sender map.
     */
    @Autowired
    private Map<String, KafKaSender> kafKaSenderMap;

    /**
     * Gets sender.
     *
     * @param bizType the biz type
     * @return the sender
     */
    public KafKaSender getSender(KafKaMsgBizType bizType) {
        switch (bizType) {
            case ORDER_BIZ:
                return kafKaSenderMap.get("orderSender");
            default:
                throw new IllegalArgumentException("bizType error");
        }
    }
}
